/// <reference path="../Math/Vector2.ts" />
module ew {
    export class Unit {
        public position: Vector2;
        public velocity: Vector2;
        public acceleration: Vector2;
        public rotation: number;
        public rotationSpeed: number;

        constructor();
        constructor(position: Vector2);
        constructor(position: Vector2, velocity: Vector2);

        constructor(position?: Vector2, velocity?: Vector2) {
            this.position = position != undefined ? position : Vector2.zero;
            this.velocity = velocity != undefined ? velocity : Vector2.zero;
            this.acceleration = Vector2.zero;
            this.rotation = 0;
            this.rotationSpeed = 0;
        }

        public update(): void {
            this.velocity = this.velocity.add(this.acceleration);
            this.position = this.position.add(this.velocity);
            this.rotation += this.rotationSpeed;
        }

        public draw(context: CanvasRenderingContext2D): void {
            throw new Error("Abstract method");
        }
    }
}